home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3286 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.9 KB

  1. Path: news-feed.mci.newscorp.com!usenet
  2. From: pbe@pobox.com
  3. Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
  4. Subject: Re: C++ with Zapp vs. Delphi
  5. Date: 23 Jan 1996 02:47:25 GMT
  6. Organization: Phoenix Business Enterprises
  7. Message-ID: <4e1i7t$v29@klein.delphi.com>
  8. References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <DBk8wg2yqjbB083yn@iaccess.za> <4d7pmb$48c8@tigger.cc.uic.edu> <4dk38h$gdr@merlin.delphi.com> <4dksp1$3d6c@tigger.cc.uic.edu>
  9. NNTP-Posting-Host: 206.15.161.89
  10. X-To: olczyk@sunphy1 (Jung Oh)
  11. X-Mailer: SQUID
  12. X-Registration: $737961
  13.  
  14. >How do you write a class SortedList which maintains a list of objects which 
  15. >have a method CompareTo. This lists keeps the objects in sorted order based
  16. >on CompareTo. You also know that 
  17. >1) It will be used over a long period of time, and there will be many differe
  18. >   classes stored there.
  19. >2) In some applications, there will be several instances which hold
  20. >   different types.
  21. >3) Some of the objects stored come from classes which have to inherit from
  22. >   something else.
  23.  
  24.      Create an abstract. Look at TStrings.
  25.  
  26. >4) Management insists that programmers only get dcu's-- no source. They 
  27. >   know that distributing source over the organization causes some of the 
  28. >   worst maintenance problems.
  29.  
  30.      This has NOTHING to do with OO or not, this has to do with a FAST
  31. single pass compiler.
  32.  
  33.      Use an OCX if you need this.
  34.  
  35. >If you have MI it's easy. Just create a class called SortedObject with
  36. >a virtual method called CompareTo. Store objects of that type in the list.
  37.  
  38.      Abstract method in Delphi.
  39.  
  40. >An class that need to get stored can then inherit from SortedObject.
  41. >Unfortunately you can't use this in Delphi since you know some of the
  42. >classes already inherit from something else.
  43.  
  44.      You can to do this! Look at TStrings!
  45.  
  46. >If your language is dynamically typed, it's easy. In the sort routine
  47. >send the message CompareTo. Unfortunatly Delphi is statically typed.
  48.  
  49.      Just CALL it!  (Declare an Abstract!)
  50.  
  51.      Either we are miscommunicating, and one of us does not understand the
  52. other, or both, but it seems to me you may want to check into Delphi a little
  53. more.
  54.  
  55.      If I am not understanding you, excuse me.  I can read C, but am by no
  56. means a C expert.
  57.  
  58. _
  59. Pennsylvania: The land of Potholes.
  60.  
  61. +------------------------------------------------------------+
  62. |* Chad Z. Hower  -  phoenix@pobox.com                       |
  63. |* Consultant - Phoenix Business Enterprises                 |
  64. |         pbe@pobox.com   -   http://pobox.com/~pbe          |
  65. |* Principal Analyst Programmer -                            |
  66. |         SCB Computer Technology Inc - czhower@eastman.com  |
  67. |Physically in Church Hill, TN - Logically Not Sure          |
  68. |     **** My Opinions are my own, I don't steal them ****   |
  69. +------------------------------------------------------------+
  70. >>SQUID - The ultimate database reader, and NO limits. #$737961
  71. **Special Compile: 1.033B (Beta)
  72.